import type { IRentDouyinStoreOrderNoDTO, IRentMachineOrderInfoList } from "@/types/rentMachineManage/rentMachineOrderInfo";

/* 小店订单号 */
function useStoreOrderNo(fn?: () => void) {
  const storeOrderNoVisible = ref(false);
  const storeOrderNoForm = ref<IRentDouyinStoreOrderNoDTO>({
    id: 0,
    out_bill_no: ""
  });

  /* 打开填写小店订单号模态框 */
  function handleDouyinStoreOrderNo(row: IRentMachineOrderInfoList) {
    storeOrderNoForm.value.id = row.id;
    storeOrderNoForm.value.out_bill_no = "";
    storeOrderNoVisible.value = true;
  }

  /* 复制订单成功回调 */
  function handleDouyinStoreOrderNoSuccess() {
    storeOrderNoVisible.value = false;
    if (fn) {
      fn();
    }
  }

  return {
    storeOrderNoVisible,
    storeOrderNoForm,
    handleDouyinStoreOrderNo,
    handleDouyinStoreOrderNoSuccess
  };
}

export default useStoreOrderNo;
